﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace BindingLesson.DataCollection
{
    public class MyDataTemplateSelector : DataTemplateSelector
    {
        public DataTemplate MormalDataTemplate { get; set; }
        public DataTemplate AlarmDataTemplate { get; set; }
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            var data = item as DataSourceItem;
            if(data.State == 1)
                return AlarmDataTemplate;
            return  MormalDataTemplate;
        }
    }
}
